<!-- 设置优惠券 -->
<template>
	<div class=''>
		<div style="margin-bottom: 30px;margin-top: 60px;position: relative;">
			<search :type='2'></search>
			<div style="position: absolute;right: 150px;top:0px">
				<el-button type="primary" @click="creatCouponBtn">创建优惠券</el-button>
			</div>
		</div>
		<div>
			<el-table :data="tableData" style="width: 100%;" :header-cell-style="{ background: '#eef1f6' }">
				<el-table-column prop="date" label="创建时间" width="180" align="center"></el-table-column>
				<el-table-column prop="type" label="券类型" align="center"></el-table-column>
				<el-table-column prop="mc" label="券名称" width="100" align="center"></el-table-column>
				<el-table-column prop="set" label="活动券配置" align="center"></el-table-column>
				<el-table-column prop="statu" label="状态" width="70" align="center"></el-table-column>
				<el-table-column prop="day" label="一体机展示" align="center"></el-table-column>
				<el-table-column prop="" label="操作" fixed="right" align="center">
					<template slot-scope="scope">
						<el-button type="text" @click="start(scope.row.name,0)">停用</el-button>
						<el-button type="text" @click="start(scope.row.name,1)">启用</el-button>
						<el-button type="text" @click="set">编辑</el-button>
						<el-button type="text" @click="code">预览二维码</el-button>
					</template>
				</el-table-column>
				>
			</el-table>
		</div>
		
		<start :startAlert='startAlert' :type='startType' :name='coupName' @startClose='startAlert=false'></start>
		<codes :codeAlert="codeAlert" @codeClose='codeAlert=false'></codes>
		
	</div>
</template>

<script>
	import codes from '../Alert/img.vue'
	import search from '../public/searchTable.vue'
	import start from '../Alert/start.vue'
	export default {
		components: {
			search,
			start,
			codes
		},
		data () {
			return {
				//二维码
				codeAlert:false,
				
				// 启用优惠券弹窗
				startAlert:false,
				startType:0,
				coupName:'',
				// 
				tableData: [
					{ date: '2019-09-04 16:00:11', name: '张三', phone: '15528034555', type: '满减', mc: '测试券1', code: '1231415', statu: '1', num: '1', day: '50', set: '满200元-10' },
					{ date: '2019-09-04 16:00:11', name: '张三', phone: '15528034555', type: '满减', mc: '测试券1', code: '1231415', statu: '2', num: '1', day: '50', set: '满200元-10' },
					{ date: '2019-09-04 16:00:11', name: '张三', phone: '15528034555', type: '满减', mc: '测试券1', code: '1231415', statu: '3', num: '1', day: '50', set: '满200元-10' },
					{ date: '2019-09-04 16:00:11', name: '张三', phone: '15528034555', type: '满减', mc: '测试券1', code: '1231415', statu: '4', num: '1', day: '50', set: '满200元-10' }
				],
			};
		},
		computed: {

		},
		methods: {
			/**
			 * 启用停用
			 */
			start(val,type){
				this.coupName=val
				
				this.startAlert=true
				this.startType=type
			},
			/**
			 * 编辑
			 */
			set(){},
			/**
			 * 预览二维码
			 */
			code(){
				this.codeAlert=true
			},
			//点击创建优惠券按钮
			creatCouponBtn(){
				console.log("creatCouponBtn")
				this.$router.push({
					path:"/creatCoupon"
				})
			}
		},
mounted() {

},
created() {}, //生命周期 - 创建之后
	}
</script>

<style scoped>

</style>